package Year22_Month07.day18;

public class 整数拆分 {
    public int integerBreak(int n) {
        int[] dp = new int[n + 1];
        dp[0] = dp[1] = 0;
        for (int i = 2; i < n; i++) {
            int max = 0;
            for (int j = 1; j < i; j++) {
                max = Math.max(max,Math.max(j * (i - j),j * dp[j - i]));
            }
            dp[i] = max;
        }
        return dp[n];
    }
}
